package _16线程优先级_了解;

public class Demo {
    public static void main(String[] args) {
        Thread t1 = new Thread(new Runnable() {
            @Override
            public void run() {
                for (int i = 0; i < 200; i++) {
                    System.out.println("t1:"+i);
                }
            }
        });

        Thread t2 = new Thread(new Runnable() {
            @Override
            public void run() {
                for (int i = 0; i < 20000; i++) {
                    System.out.println("t2:"+i);
                }
            }
        });

        //设置优先级,setPriority(),参数为1-10，数字越大，优先级越高，默认优先级为5
        t1.setPriority(1);
        t2.setPriority(10);

        t2.start();
        t1.start();
    }
}
